<?php
 If (!IsSet ($reentrance))
  {
   Session_Start () ;
   Include ($_SESSION ["repertoire_config"]."/garennes.cfg") ;
   Include ($_SESSION ["repertoire_config"]."/init.php") ;
   Include ("../include/config.inc") ;
   verif_droits ($droit_courant, $_SESSION ["code"]) ;
  }
 
 $resultats = SQL_commande ("SELECT * FROM menus WHERE numero='".$droit_courant."' AND ordre='0'", $id_sql) ;
 $l = SQL_tableau_associatif ($resultats, "") ; 
 
 $professeur = utilparcode ($_SESSION ["code"]) ;
 $nom_classe = nom_classe_long_parid ($id_classe) ;
 $effectifs = effectif ($id_classe) ;
 $num_p = periode_valide ($id_classe) ;
 $nom_p = nom_periode ($id_classe) ;
 $nbr_p = nombre_periode ($id_classe) ;
 
 Echo "<HTML><HEAD>" ;
 entete_html ("Garennes", "travail_affichage", 0) ;
 Echo styles ("none", "none", "none", $l ["nom"], "none") ;
 Echo "</HEAD>" ; 
 
 Echo "<BODY BGCOLOR=\"".$l ["couleur_fond"]."\" TEXT=\"".$l ["couleur_texte"]."\">" ;

 If ($id_classe)
  {
   Echo "  <SCRIPT>\n" ;
   Echo "   top.menu_status.document.clear ()\n" ;
   Echo "   top.menu_status.document.close ()\n" ;
   Echo "   top.menu_status.document.writeln (\"<HTML>\")\n" ;
   Echo "   top.menu_status.document.writeln (\"<BODY BGCOLOR=\\\"".$l ["couleur_fond"]."\\\">\")\n" ;
   Echo "   top.menu_status.document.writeln (\"<CENTER><FONT COLOR=\\\"".$l ["couleur_texte"]."\\\"><B>Classe</B></FONT></CENTER>\")\n" ;
   Echo "   top.menu_status.document.writeln (\"<TABLE BGCOLOR=\\\"".$l ["lien"]."\\\" BORDER=0 WIDTH=\\\"90%\\\" ALIGN=\\\"CENTER\\\"CELLSPACING=0 CELLPADDING=0>\")\n" ;
   Echo "   top.menu_status.document.writeln (\"<TR>\")\n" ;
   Echo "   top.menu_status.document.writeln (\"<TD ALIGN=CENTER VALIGN=MIDDLE HEIGHT=\\\"100%\\\">&nbsp;<B>" ;
   If (StrLen ($nom_classe) > 14) { Echo "<FONT SIZE=\\\"-2\\\">".$nom_classe."</FONT>" ; } Else { Echo $nom_classe ; }
   Echo "</B>&nbsp;<BR>&nbsp;(".$effectifs."&nbsp;&eacute;l&egrave;ves)&nbsp;</TD>\")\n" ;
   Echo "   top.menu_status.document.writeln (\"</TR>\")\n" ;
   Echo "   top.menu_status.document.writeln (\"</TABLE>\")\n" ;
   Echo "   top.menu_status.document.writeln (\"</BODY>\")\n" ;
   Echo "   top.menu_status.document.writeln (\"</HTML>\")\n" ;
   Echo "  </SCRIPT>\n" ;
   Echo "  <TABLE BORDER=0 WIDTH=\"100%\" HEIGHT=\"100%\" CELLSPACING=0 CELLPADDING=0 vALIGN=TOP>\n" ;
   Echo "   <TR>\n" ;
   
   Echo "    <TD>\n" ;
   Echo "     <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 vALIGN=TOP>\n" ;
   Echo "      <FORM ACTION=\"./trombinoscope.php\" NAME=\"saisie\" METHOD=\"POST\">\n" ;
   Echo "       <TR>\n" ;
   Echo "        <TD ALIGN=MIDDLE VALIGN=TOP>\n" ;
   Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"code\" VALUE=\"".$_SESSION ["code"]."\">\n" ;
   Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"id_classe\" VALUE=\"".$id_classe."\">\n" ;
   Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"titre\" VALUE=\"1\">\n" ;
   Echo "         <INPUT TYPE=\"IMAGE\" SRC=\"../images/trombinoscope.png\" TITLE=\"Trombinoscope de la classe.\" BORDER=0>\n" ;
   Echo "        </TD>\n" ;
   Echo "       </TR>\n" ;
   Echo "      </FORM>\n" ;
   Echo "     </TABLE>\n" ;
   Echo "    </TD>\n" ;
   
   $table = eleves_par_prof ($professeur) ;
   // Consultation du carnet des CPE precedentes
   If ((($num_p >= 1) And ($saisie == 0)) Or ($num_p > 1))
    {
     // Affichage de toutes les disciplines enseignees par le prof
     For ($i = 1 ; $i < $num_p ; $i++)
      {
       Echo "    <TD>\n" ;
       Echo "     <FORM ACTION=\"./saisie.php\" NAME=\"saisie\" METHOD=\"POST\">\n" ;
       Echo "      <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 vALIGN=TOP>\n" ;
       Echo "       <TR>\n" ;
       Echo "        <TD ALIGN=MIDDLE VALIGN=TOP>\n" ;
       Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"code\" VALUE=\"".$_SESSION ["code"]."\">\n" ;
       Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"id_classe\" VALUE=\"".$id_classe."\">\n" ;
       Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"saisie\" VALUE=\"0\">\n" ;
       Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"periode\" VALUE=\"".$i."\">\n" ;
       Echo "         <INPUT TYPE=\"IMAGE\" SRC=\"../images/bulletin".$i.".png\" BORDER=0 TITLE=\"Acc&egrave;s au carnet CPE de la p&eacute;riode ".$i.".\">\n" ;
       Echo "        </TD>\n" ;
       Echo "       </TR>\n" ;
       Echo "      </TABLE>\n" ;
       Echo "     </FORM>\n" ;
       Echo "    </TD>\n" ;
      }
    }

   // Saisie des CPE
   If ($saisie == 1)
    {
     Echo "    <TD>\n" ;
     Echo "     <FORM ACTION=\"./saisie.php\" NAME=\"saisie\" METHOD=\"POST\">\n" ;
     Echo "      <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 vALIGN=TOP>\n" ;
     Echo "       <TR>\n" ;
     Echo "        <TD ALIGN=MIDDLE VALIGN=TOP>\n" ;
     Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"code\" VALUE=\"".$_SESSION ["code"]."\">\n" ;
     Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"id_classe\" VALUE=\"".$id_classe."\">\n" ;
     Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"saisie\" VALUE=\"1\">\n" ;
     Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"periode\" VALUE=\"".$num_p."\">\n" ;
     Echo "         <INPUT TYPE=\"IMAGE\" SRC=\"../images/bulletin".$num_p.".png\" BORDER=0 TITLE=\"Acc&egrave;s &agrave; la saisie de la p&eacute;riode ".$num_p.".\">\n" ;
     Echo "        </TD>\n" ;
     Echo "       </TR>\n" ;
     Echo "      </TABLE>\n" ;
     Echo "     </FORM>\n" ;
     Echo "    </TD>\n" ;
    }
   
   // Menu moyennes
   For ($i = 1 ; $i <= $num_p ; $i++)
    {
     Echo "    <TD>\n" ;
     Echo "     <FORM ACTION=\"./moyennes.php\" NAME=\"moyennes\" METHOD=\"POST\">\n" ;
     Echo "      <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 vALIGN=TOP>\n" ;
     Echo "       <TR>\n" ;
     Echo "        <TD ALIGN=MIDDLE VALIGN=TOP>\n" ;
     Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"code\" VALUE=\"".$_SESSION ["code"]."\">\n" ;
     Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"id_classe\" VALUE=\"".$id_classe."\">\n" ;
     Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"titre\" VALUE=\"1\">\n" ;
     Echo "         <INPUT TYPE=HIDDEN NAME=\"periode\" VALUE=\"".$i."\">\n" ;
     Echo "         <INPUT TYPE=IMAGE SRC=\"../images/moyennes".$i.".png\" TITLE=\"Moyennes de la classe\" BORDER=0>\n" ;
     Echo "        </TD>\n" ;
     Echo "       </TR>\n" ;
     Echo "      </TABLE>\n" ;
     Echo "     </FORM>\n" ;
     Echo "    </TD>\n" ;
    }

   // Menu Graphe
   Echo "    <TD ROWSPAN=2 vALIGN=MIDDLE>\n" ;
   Echo "     <FORM ACTION=\"./bilan_eleve.php\" METHOD=\"POST\">\n" ;
   Echo "      <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 vALIGN=TOP>\n" ;
   Echo "       <TR>\n" ;
   Echo "        <TD ALIGN=CENTER VALIGN=TOP>\n" ;
   Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"code\" VALUE=\"".$_SESSION ["code"]."\">\n" ;
   Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"id_classe\" VALUE=\"".$id_classe."\">\n" ;
   Echo "         <INPUT TYPE=\"HIDDEN\" NAME=\"periode\" VALUE=\"".periode_valide ($id_classe)."\">\n" ;
   Echo "         <INPUT TYPE=\"IMAGE\" SRC=\"../images/graphes.png\" BORDER=0 TITLE=\"Bilan de la classe...\">\n" ;
   Echo "        </TD>\n" ;
   Echo "       </TR>\n" ;
   Echo "      </TABLE>\n" ;
   Echo "     </FORM>\n" ;
   Echo "    </TD>\n" ;

   Echo "   </TR>\n" ;
   Echo "  </TABLE>\n" ;
  }
 Echo " </BODY>\n" ;
 Echo "</HTML>\n" ;
?>